package cn.itsnkkka.utils;

import cn.itsnkkka.domain.dto.RabbitMQObjectDTO;
import com.fasterxml.jackson.core.JsonProcessingException;

/**
 * @author xuezipeng
 * @date 2023-04-23 13:13
 */
public class MQUtils {
    public static   <T extends RabbitMQObjectDTO> T transform(final Object obj, final Class<T> clazz){
        try {
            String jsonString = JSONUtils.toJSONString(obj);
            return JSONUtils.parse(clazz, jsonString);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return null;
        }
    }
}
